package warmachinesystem.presentation.editpart;

import java.util.List;

import warmachineroster.Roster;
import warmachinesystem.BaseUnit;
import warmachinesystem.Solo;
import warmachinesystem.Unit;
import warmachinesystem.UnitAttachment;
import warmachinesystem.Warcaster;
import warmachinesystem.Warjack;

public class ListTreeEditPart extends WarmachineGameSystemAbstractTreeEditPart {


	public ListTreeEditPart(List<?> model, Roster roster) {
		super(model, roster);
	}
	
	@Override
	public String getText(){
		String text ="";
		BaseUnit firstElem = getUnitList().get(0);
		if (firstElem instanceof Warcaster){
			text ="Warcasters";
		}
		else if (firstElem instanceof Warjack){
			text ="Warjacks";
		}
		else if (firstElem instanceof Unit){
			text ="Units";
		}
		else if (firstElem instanceof Solo){
			text ="Solos";
		}
		else if (firstElem instanceof UnitAttachment){
			text ="UnitAttachments";
		}
		return text;
	}
	
	@SuppressWarnings("unchecked")
	public List<BaseUnit> getUnitList(){
		return (List<BaseUnit>) getModel();
	}
	
	public List<?> getModelChildren(){
		return (List<?>) getModel();
	}


}
